<template>
    <div>
      <h1>创建用户</h1>
      <UserForm @submit="handleCreateUser" />
    </div>
  </template>
  
  <script setup lang="ts">
  import { useRouter } from 'vue-router'
  import { useUserStore } from '../stores/user'
  import UserForm from '../components/UserForm.vue'
  
  const userStore = useUserStore()
  const router = useRouter()
  
  const handleCreateUser = async (user: any) => {
    await userStore.addUser(user)
    router.push('/users')
  }
  </script>